//
//  UIView+getViewController.m
//  yuwei
//
//  Created by baozi on 15/4/19.
//  Copyright (c) 2015年 youyuwei. All rights reserved.
//

#import "UIView+getViewController.h"

@implementation UIView(getViewController)

-(UIViewController *)getViewController
{
    for (UIView* next = [self superview]; next; next = next.superview) {
        UIResponder* nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController*)nextResponder;
        }
    }
    return nil;
}

@end
